<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>用户管理</title>
	<meta name="decorator" content="default"/>
	<%@include file="/WEB-INF/views/include/dialog.jsp" %>
	<style type="text/css">.sort{color:#0663A2;cursor:pointer;}</style>
	<script type="text/javascript">
		$(document).ready(function() {
			// 表格排序
			var orderBy = $("#orderBy").val().split(" ");
			$("#contentTable th.sort").each(function(){
				if ($(this).hasClass(orderBy[0])){
					orderBy[1] = orderBy[1]&&orderBy[1].toUpperCase()=="DESC"?"down":"up";
					$(this).html($(this).html()+" <i class=\"icon icon-arrow-"+orderBy[1]+"\"></i>");
				}
			});
			$("#contentTable th.sort").click(function(){
				var order = $(this).attr("class").split(" ");
				var sort = $("#orderBy").val().split(" ");
				for(var i=0; i<order.length; i++){
					if (order[i] == "sort"){order = order[i+1]; break;}
				}
				if (order == sort[0]){
					sort = (sort[1]&&sort[1].toUpperCase()=="DESC"?"ASC":"DESC");
					$("#orderBy").val(order+" DESC"!=order+" "+sort?"":order+" "+sort);
				}else{
					$("#orderBy").val(order+" ASC");
				}
				page();
			});
		});
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").attr("action","${ctx}/sys/sysuser/");
			$("#searchForm").submit();
	    	return false;
	    }
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/sys/sysuser/">用户列表</a></li>
<%-- 		<shiro:hasPermission name="/sys/sysuser/save"> --%>
		<li><a href="${ctx}/sys/sysuser/form">用户添加</a></li>
<%-- 		</shiro:hasPermission> --%>
	</ul>
	<form:form id="searchForm" commandName="user" action="${ctx}/sys/sysuser/" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${pageSize}"/>
		<input id="orderBy" name="orderBy" type="hidden" value="${orderBy}"/>
        <label>类型：</label><form:select  class="input-small"  path="type"><form:option value="" label="请选择"/><form:options items="${fns:getDictList('sys_user_type')}" itemLabel="label" itemValue="value" htmlEscape="false"/></form:select>
	    <label>登录名：</label><form:input path="loginName" htmlEscape="false" maxlength="50" class="input-small"/>
		<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询" onclick="return page();"/>
	</form:form>
	<tags:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead><tr><th class="loginName">登录名</th><th class="name">昵称</th><th>邮箱</th><th>用户类型</th>
<%-- 		<shiro:hasPermission name="/sys/sysuser/save"> --%>
		<th>操作</th>
<%-- 		</shiro:hasPermission> --%>
		</tr></thead>
		<tbody>
		<c:forEach items="${page}" var="user">
			<tr>
				<td><a href="${ctx}/sys/sysuser/form?id=${user.id}">${user.loginName}</a></td>
				<td>${user.nickName}</td>
				<td>${user.email}</td>
				<td>${fns:getDictLabel(user.type, 'sys_user_type', '无')}</td>
<%-- 				<shiro:hasPermission name="/sys/sysuser/save"> --%>
				<td>
    				<a href="${ctx}/sys/sysuser/form?id=${user.id}">修改</a>
					<a href="${ctx}/sys/sysuser/delete?id=${user.id}" onclick="return confirmx('确认要删除该用户吗？', this.href)">删除</a>
				</td>
<%-- 				</shiro:hasPermission> --%>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<tags:pagination paginationSize="10" page="${page }"></tags:pagination>
</body>
</html>